<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
   
    <link rel="stylesheet" href="https://unpkg.com/animate.css@3.5.2/animate.min.css"><!-- 引入在线的animate.css文件 -->
    <!-- <style>
        
    /* keyframes动画 */
        @keyframes bounce-in{
            0%{
                transform:scale(0);/* 改变：规模（多少倍） */
            }
            50%{
                transform:scale(1.5);
            }
            100%{
                transform:scale(1);
            }
        }
        .fade-enter-active{
            transform-origin: left center;
            animation: bounce-in 1s;
        }
        .fade-leave-active{
            transform-origin: left center;
            animation: bounce-in 1s reverse;
        }
    </style> -->
    <!-- 过渡动画 -->
    <style>
        .fade-enter,
        .fade-leave-to{
            opacity: 0;
        }
        .fade-enter-active,
        .fade-leave-active{
            transition:opacity 3s;
        }
    </style>
</head>
<body>
    <!-- animate用的动画是keyframes动画 -->
    <div id="app"> 
         <!-- type="transition"以transition中最长时间为准 -->
         <!-- :duration="1000"设置动画时长为1000ms,:duration="{enter:1000,leave:2000}"设置入场动画1000ms出场动画2000ms -->   
         <!-- appear表示第一次显示时也有动画效果 -->    
         <!-- enter-active-class显示动画 -->      
         <!-- leave-active-class隐藏动画 -->
        <transition
         type="transition"
         name="fade" 
         appear     
         enter-active-class="animated shake fade-enter-active" 
         leave-active-class="animated swing fade-leave-active"
         appear-active-class="animated shake"
         ><!-- transition包裹的内容会有动画过渡效果 -->
            <div v-if="show">hello world</div>
        </transition>
        <button @click="handleClick">切换</button>
    </div>
    <script>
        var vm=new Vue({
            el:'#app',
            data:{
                show:true
            },
            methods:{
                handleClick:function(){
                    this.show=!this.show;
                }
            }

        })
    </script>
</body>
</html>